<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>健身中心视频监控系统</title>
    <!-- 引入Font Awesome图标库 -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <!-- 引入Google字体 -->
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
    <!-- 引入jQuery -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="jquery.rotate.js"></script>
    
    <style>
        :root {
            --primary-color: #3a86ff;
            --secondary-color: #8338ec;
            --dark-bg: #1a1a2e;
            --darker-bg: #16213e;
            --light-text: #e6e6e6;
            --lighter-text: #ffffff;
            --accent-color: #ff9e00;
            --danger-color: #ff3a3a;
            --success-color: #06d6a0;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Roboto', sans-serif;
            background: var(--dark-bg);
            color: var(--light-text);
            height: 100vh;
            display: flex;
            flex-direction: column;
        }
        
        .header {
            background: linear-gradient(135deg, var(--darker-bg), var(--dark-bg));
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            z-index: 10;
        }
        
        .logo {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        
        .logo i {
            font-size: 2rem;
            color: var(--accent-color);
        }
        
        .logo-text h1 {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--lighter-text);
        }
        
        .logo-text p {
            font-size: 0.9rem;
            color: var(--light-text);
            opacity: 0.8;
        }
        
        .status-bar {
            display: flex;
            align-items: center;
            gap: 2rem;
        }
        
        .status-indicator {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .status-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background-color: var(--success-color);
            box-shadow: 0 0 10px var(--success-color);
        }
        
        .datetime {
            font-size: 0.9rem;
            color: var(--light-text);
        }
        
        .main-content {
            display: flex;
            flex: 1;
            overflow: hidden;
        }
        
        .video-container {
            flex: 1;
            padding: 2rem;
            display: flex;
            flex-direction: column;
            background: rgba(0, 0, 0, 0.2);
        }
        
        .video-wrapper {
            position: relative;
            flex: 1;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            background: #000;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        #streamimage {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            transition: all 0.3s ease;
        }
        
        .video-controls {
            display: flex;
            justify-content: center;
            gap: 1rem;
            margin-top: 1.5rem;
            flex-wrap: wrap;
        }
        
        .control-btn {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: var(--light-text);
            padding: 0.8rem 1.5rem;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.9rem;
            transition: all 0.2s ease;
        }
        
        .control-btn:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: translateY(-2px);
        }
        
        .control-btn.active {
            background: var(--primary-color);
            color: white;
        }
        
        .control-btn i {
            font-size: 1rem;
        }
        
        .sidebar {
            width: 300px;
            background: var(--darker-bg);
            padding: 1.5rem;
            overflow-y: auto;
            border-left: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .sidebar-section {
            margin-bottom: 2rem;
        }
        
        .sidebar-title {
            font-size: 1.1rem;
            margin-bottom: 1rem;
            color: var(--lighter-text);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .sidebar-title i {
            color: var(--accent-color);
        }
        
        .camera-list {
            display: flex;
            flex-direction: column;
            gap: 0.8rem;
        }
        
        .camera-item {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 8px;
            padding: 0.8rem;
            cursor: pointer;
            transition: all 0.2s ease;
            border: 1px solid transparent;
        }
        
        .camera-item:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: var(--primary-color);
        }
        
        .camera-item.active {
            background: rgba(58, 134, 255, 0.2);
            border-color: var(--primary-color);
        }
        
        .camera-thumbnail {
            width: 100%;
            height: 120px;
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 0.5rem;
            position: relative;
        }
        
        .camera-thumbnail img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .camera-status {
            position: absolute;
            bottom: 0.5rem;
            right: 0.5rem;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 0.2rem 0.5rem;
            border-radius: 4px;
            font-size: 0.7rem;
        }
        
        .camera-status.online {
            color: var(--success-color);
        }
        
        .camera-status.offline {
            color: var(--danger-color);
        }
        
        .camera-info h3 {
            font-size: 0.9rem;
            margin-bottom: 0.2rem;
            color: var(--lighter-text);
        }
        
        .camera-info p {
            font-size: 0.8rem;
            color: var(--light-text);
            opacity: 0.7;
        }
        
        .settings-group {
            margin-bottom: 1.5rem;
        }
        
        .settings-label {
            display: block;
            margin-bottom: 0.5rem;
            font-size: 0.9rem;
            color: var(--light-text);
        }
        
        .settings-input {
            width: 100%;
            padding: 0.6rem;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            color: var(--light-text);
        }
        
        .settings-input:focus {
            outline: none;
            border-color: var(--primary-color);
        }
        
        .footer {
            background: var(--darker-bg);
            padding: 1rem;
            text-align: center;
            font-size: 0.8rem;
            color: var(--light-text);
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        /* 旋转变换样式 */
        .xform-p {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .xform {
            transition: transform 0.3s ease;
        }
        
        /* 旋转角度类 */
        .x-rotated-90 {
            transform: rotate(90deg);
        }
        
        .x-rotated-180 {
            transform: rotate(180deg);
        }
        
        .x-rotated-270 {
            transform: rotate(270deg);
        }
        
        /* 镜像类 */
        .x-mirrored {
            transform: scaleX(-1);
        }
        
        /* 翻转类 */
        .x-flipped {
            transform: scaleY(-1);
        }
        
        /* 组合变换 */
        .x-mirrored-rotated-90 {
            transform: scaleX(-1) rotate(90deg);
        }
        
        .x-mirrored-rotated-180 {
            transform: scaleX(-1) rotate(180deg);
        }
        
        .x-mirrored-rotated-270 {
            transform: scaleX(-1) rotate(270deg);
        }
        
        .x-flipped-rotated-90 {
            transform: scaleY(-1) rotate(90deg);
        }
        
        .x-flipped-rotated-180 {
            transform: scaleY(-1) rotate(180deg);
        }
        
        .x-flipped-rotated-270 {
            transform: scaleY(-1) rotate(270deg);
        }
        
        .x-flipped-mirrored-rotated-90 {
            transform: scaleY(-1) scaleX(-1) rotate(90deg);
        }
        
        .x-flipped-mirrored-rotated-180 {
            transform: scaleY(-1) scaleX(-1) rotate(180deg);
        }
        
        .x-flipped-mirrored-rotated-270 {
            transform: scaleY(-1) scaleX(-1) rotate(270deg);
        }
        
        /* 响应式设计 */
        @media (max-width: 1024px) {
            .main-content {
                flex-direction: column;
            }
            
            .sidebar {
                width: 100%;
                border-left: none;
                border-top: 1px solid rgba(255, 255, 255, 0.1);
            }
            
            .video-container {
                padding: 1rem;
            }
        }
    </style>
</head>
<body>
    <header class="header">
        <div class="logo">
            <i class="fas fa-video"></i>
            <div class="logo-text">
                <h1>健身中心监控系统</h1>
                <p>实时视频监控平台</p>
            </div>
        </div>
        <div class="status-bar">
            <div class="status-indicator">
                <div class="status-dot"></div>
                <span>在线</span>
            </div>
            <div class="datetime" id="currentDateTime">2023-06-15 14:30:45</div>
        </div>
    </header>
    
    <div class="main-content">
        <div class="video-container">
            <div class="video-wrapper">
                <div id="streamwrap" class="xform-p">
                    <img id="streamimage" class="xform" src="./?action=stream" />
                </div>
            </div>
            
            <div class="video-controls">
                <button id="rotate" class="control-btn">
                    <i class="fas fa-undo"></i> 旋转
                </button>
                <button id="mirror" class="control-btn">
                    <i class="fas fa-exchange-alt"></i> 镜像
                </button>
                <button id="flip" class="control-btn">
                    <i class="fas fa-arrows-alt-v"></i> 翻转
                </button>
                <button class="control-btn">
                    <i class="fas fa-expand"></i> 全屏
                </button>
                <button class="control-btn">
                    <i class="fas fa-camera"></i> 截图
                </button>
                <button class="control-btn">
                    <i class="fas fa-cog"></i> 设置
                </button>
                <!-- 返回按钮 -->
                <button class="control-btn" id="backToWorld">
                    <i class="fas fa-arrow-left"></i> 返回首页
                </button>
            </div>
        </div>
        
        <div class="sidebar">
            <div class="sidebar-section">
                <h2 class="sidebar-title">
                    <i class="fas fa-list"></i> 摄像头列表
                </h2>
                <div class="camera-list">
                    <div class="camera-item active">
                        <div class="camera-thumbnail">
                            <img src="./?action=stream" alt="主摄像头">
                            <span class="camera-status online">在线</span>
                        </div>
                        <div class="camera-info">
                            <h3>主摄像头</h3>
                            <p>器械区A</p>
                        </div>
                    </div>
                    <div class="camera-item">
                        <div class="camera-thumbnail">
                            <img src="https://via.placeholder.com/300x200?text=摄像头2" alt="摄像头2">
                            <span class="camera-status online">在线</span>
                        </div>
                        <div class="camera-info">
                            <h3>摄像头2</h3>
                            <p>器械区B</p>
                        </div>
                    </div>
                    <div class="camera-item">
                        <div class="camera-thumbnail">
                            <img src="https://via.placeholder.com/300x200?text=摄像头3" alt="摄像头3">
                            <span class="camera-status online">在线</span>
                        </div>
                        <div class="camera-info">
                            <h3>摄像头3</h3>
                            <p>瑜伽室</p>
                        </div>
                    </div>
                    <div class="camera-item">
                        <div class="camera-thumbnail">
                            <img src="https://via.placeholder.com/300x200?text=摄像头4" alt="摄像头4">
                            <span class="camera-status offline">离线</span>
                        </div>
                        <div class="camera-info">
                            <h3>摄像头4</h3>
                            <p>更衣室入口</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="sidebar-section">
                <h2 class="sidebar-title">
                    <i class="fas fa-sliders-h"></i> 视频设置
                </h2>
                <div class="settings-group">
                    <label class="settings-label">亮度</label>
                    <input type="range" class="settings-input" min="0" max="100" value="50">
                </div>
                <div class="settings-group">
                    <label class="settings-label">对比度</label>
                    <input type="range" class="settings-input" min="0" max="100" value="50">
                </div>
                <div class="settings-group">
                    <label class="settings-label">饱和度</label>
                    <input type="range" class="settings-input" min="0" max="100" value="50">
                </div>
            </div>
        </div>
    </div>
    
    <footer class="footer">
        <p>健身中心监控系统 &copy; 2023 | 版本 2.1.0</p>
    </footer>
    
    <script>
        // 旋转、镜像、翻转功能
        var phi = 0, flipped = 0, mirrored = 0;
        
        function setXformClass() {
            $('.xform').each(function(idx, el) {
                let className = "xform";
                
                if (flipped) className += " x-flipped";
                if (mirrored) className += " x-mirrored";
                if (phi !== 0) className += " x-rotated-" + phi;
                
                // 处理组合变换
                if (flipped && mirrored && phi !== 0) {
                    className = "xform x-flipped-mirrored-rotated-" + phi;
                } else if (flipped && phi !== 0) {
                    className = "xform x-flipped-rotated-" + phi;
                } else if (mirrored && phi !== 0) {
                    className = "xform x-mirrored-rotated-" + phi;
                }
                
                el.className = className;
            });
        }
        
        $(document).ready(function() {
            // 设置旋转角度phi并切换旋转类
            $('#rotate').click(function() {
                phi = (phi + 90) % 360;
                setXformClass();
                $(this).find('i').css('transform', 'rotate(' + (phi) + 'deg)');
            });
            
            // 切换镜像类
            $('#mirror').click(function() {
                mirrored = !mirrored;
                setXformClass();
                $(this).toggleClass('active', mirrored);
            });
            
            // 切换翻转类
            $('#flip').click(function() {
                flipped = !flipped;
                setXformClass();
                $(this).toggleClass('active', flipped);
            });
            
            // 全屏功能
            $('.video-controls button:nth-child(4)').click(function() {
                const videoWrapper = $('.video-wrapper')[0];
                if (!document.fullscreenElement) {
                    videoWrapper.requestFullscreen().catch(err => {
                        alert(`全屏错误: ${err.message}`);
                    });
                } else {
                    document.exitFullscreen();
                }
            });
            
            // 截图功能
            $('.video-controls button:nth-child(5)').click(function() {
                // 这里应该是实际的截图逻辑
                alert("截图已保存");
            });
            
            // 摄像头切换
            $('.camera-item').click(function() {
                $('.camera-item').removeClass('active');
                $(this).addClass('active');
                // 这里应该是实际的摄像头切换逻辑
                const cameraId = $(this).index() + 1;
                console.log(`切换到摄像头 ${cameraId}`);
            });
            
            // 更新时间
            function updateDateTime() {
                const now = new Date();
                const formattedDate = now.toLocaleString('zh-CN', {
                    year: 'numeric',
                    month: '2-digit',
                    day: '2-digit',
                    hour: '2-digit',
                    minute: '2-digit',
                    second: '2-digit',
                    hour12: false
                });
                $('#currentDateTime').text(formattedDate);
            }
            
            setInterval(updateDateTime, 1000);
            updateDateTime();
            
            // 返回按钮功能
            $('#backToWorld').click(function() {
                window.location.href = "http://192.168.31.170/world.html";
            });
        });
    </script>
</body>
</html>